<template>
  <el-dialog
    :title="dialogObj.title"
    append-to-body
    :visible.sync="dialogObj.show"
    :close-on-click-modal="false"
    width="60%"
    class="abow_dialog"
  >
    <div v-if="dialogObj.show">
      <div class="list-content">
        <div class="form-content">
          <div class="title"><i class="el-icon-user"></i>买家信息</div>
          <p>
            账号：<i>{{ data.customerAccount }}</i>
          </p>
          <p>
            昵称：<i>{{ data.nickname }}</i>
          </p>
          <p>
            联系电话：<i>{{ data.orderPhone }}</i>
          </p>
          <div class="title"><i class="el-icon-document"></i>订单信息</div>
          <el-row>
            <el-col :span="8">
              <span
                >订单号：<i> {{ data.orderSn }}</i></span
              >
            </el-col>
            <el-col :span="8">
              <span
                >支付流水号：<i> {{ data.serialNumber }}</i></span
              >
            </el-col>
            <el-col :span="8">
              <span
                >支付方式：<i>{{ data.paymentMethod | payFilter }}</i></span
              >
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <span
                >取餐地点：<i> {{ data.pickUpPlace }} </i></span
              >
            </el-col>
            <el-col :span="8">
              <span
                >订购日期：<i>{{ data.createTime }}</i>
              </span>
            </el-col>
            <el-col :span="8"
              >领取时间：<i>{{ data.pickUpTime || "未领取" }}</i></el-col
            >
          </el-row>
          <el-row>
            <el-col :span="8">
              <span
                >订单状态：<i> {{ data.orderStatus | orderStatusFilter }}</i>
              </span>
            </el-col>
            <el-col :span="8">
              <span
                >楼层: <i>{{ data.venueFloor | floorFilter }} </i></span
              >
            </el-col>
            <el-col :span="8">
              <span
                >短信推送状态：<i> {{ data.smsSendResult | SmsFilter }}</i>
              </span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <span
                >关联活动：<i> {{ data.activityName }}</i>
              </span>
            </el-col>
            <el-col :span="8">
              <span
                >活动场次: <i>{{ data.activityTime }}</i>
              </span>
            </el-col>
            <!--  测试 -->
            <!-- <el-col :span="8">
              <span
                >领取码: <i>{{ data.pickUpNumber }}</i>
              </span>
            </el-col> -->
          </el-row>
          <div class="table-content">
            <div class="title" style="margin-bottom:10px;">
              <i class="el-icon-shopping-cart-full"></i>商品信息
            </div>
            <el-table
              :data="data.orderDetailList"
              style="width: 100%"
              border
              size="mini"
            >
              <el-table-column type="index" width="50" align="center">
              </el-table-column>
              <el-table-column prop="productName" label="商品" align="center">
              </el-table-column>
              <el-table-column label="商品图" align="center" width="100">
                <template slot-scope="scope">
                  <div>
                    <img :src="scope.row.imgUrl" class="img-size" alt="" />
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="productCnt"
                label="数量（份）"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="categoryName"
                label="商品分类"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="productPrice"
                label="单价(元)"
                align="center"
              >
              </el-table-column>

              <el-table-column
                prop="currentPrice"
                label="商品总价(元)"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="feeMoney"
                label="折后金额(元)"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="packingCharge"
                label="打包费"
                align="center"
              >
              </el-table-column>
            </el-table>
            <p class="mb-10">备注：{{ data.remark }}</p>
            <div class="table-total">
              <p>
                基础打包费：
                <span>
                  {{ data.basePackingCharge ? data.basePackingCharge : 0 }}
                  元</span
                >
              </p>
              <p>
                商品总计： <span> {{ data.orderMoney }} 元</span>
              </p>
              <p>
                优惠金额：<span>{{ data.discountMoney }} 元</span>
              </p>
              <p>
                实收金额：<span>{{ data.paymentMoney }} 元</span>
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import { orderInfoApi } from "@s/api";
import {
  FLOOROBJ,
  DISCOUNTTYPE,
  PAYTYPE,
  ORDERSTATUS,
  SMSSTATUS
} from "@u/wordbook";
export default {
  name: "dialogCom",
  props: ["dialogObj"],
  data() {
    return {
      data: []
    };
  },
  //过滤器
  filters: {
    floorFilter(val) {
      return FLOOROBJ[val];
    },
    discountFilter(val) {
      return DISCOUNTTYPE[val];
    },
    payFilter(val) {
      return PAYTYPE[val];
    },
    orderStatusFilter(val) {
      return ORDERSTATUS[val];
    },
    SmsFilter(val) {
      return SMSSTATUS[val];
    }
  },
  methods: {
    initDialog() {
      let json = {
        orderId: this.dialogObj.orderId,
        orderType: 1 //1  餐饮商品
      };
      orderInfoApi(json).then(res => {
        this.data = res;
      });
    }
  },
  watch: {
    "dialogObj.show"(val) {
      if (val) {
        this.initDialog();
      }
    }
  }
};
</script>
<style scoped lang="scss">
.form-content {
  margin: 50px 30px 30px;
  i {
    // margin: 0 5px;
    font-style: normal;
    color: #333333;
  }
  .el-col {
    // line-height: 2.4;
    margin: 12px 0px;
    font-size: 12px;
  }
  p {
    font-size: 12px;
    margin: 12px 0;
    // line-height: 2.4;

    span {
      margin-left: 30px;
    }
  }
  h4 {
    font-weight: 600;
    margin: 20px 0;
  }
}
.table-content {
  margin: 30px 0;
  overflow: hidden;
}
.table-total {
  margin-top: 20px;
  float: right;
  p {
    span {
      float: right;
      margin-left: 10px;
    }
  }
}
.img-size {
  width: 60px;
}
.title {
  background: #f1f1f1;
  padding: 10px;
  border-radius: 5px;
}
</style>
